const { Sequelize } = require('sequelize');
const { loggerSql } = require("../utils/log4")
const sequelize = new Sequelize("mySchooldb","root","mushan",{
    host:"localhost",
    port:"3306",
    dialect:"mysql",
    logging: loggerSql.info.bind(loggerSql), // 配置 Sequelize 日志输出到 loggerSql
})

// 测试数据库连接
sequelize.authenticate().then(()=>{
    console.log("数据库连接成功");
}).catch(()=>{
    console.log("数据库连接失败");
})

module.exports = sequelize;
